<template>
  <div class="app-container">
    <el-table
      v-loading="listLoading"
      :data="list"
      element-loading-text="Loading"
      border
      fit
      highlight-current-row
    >
      <el-table-column align="center" label="用户姓名">
        <template slot-scope="scope">
          {{ scope.$index }}
        </template>
      </el-table-column>
      <el-table-column label="身份证号"  align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.author }}</span>
        </template>
      </el-table-column>
      <el-table-column label="所属楼盘"  align="center">
        <template slot-scope="scope">
          {{ scope.row.pageviews }}
        </template>
      </el-table-column>
      <el-table-column label="缴纳金额"  align="center">
      <template slot-scope="scope">
        {{ scope.row.pageviews }}
      </template>
    </el-table-column>
      <el-table-column label="缴纳时间"  align="center">
        <template slot-scope="scope">
          {{ scope.row.pageviews }}
        </template>
      </el-table-column>
    </el-table>
    <div class="right" style="margin-top: 20px">
      <pagination @fetchData="fetchData" :total="total"/>
    </div>
  </div>
</template>

<script>
import { list } from '@/api/sincerity'
import pagination from '@/components/Pagination/index'
export default {
  components:{
    pagination
  },
  data() {
    return {
      total:0,
      list: null,
      listLoading: true
    }
  },
  created() {
    this.fetchData({limit:10,page:0})
  },
  methods: {
    fetchData(data) {
      this.listLoading = true
      list({limit:data.limit,page:data.page}).then(res => {
        this.total=res.total
        this.list = res.data
      }).finally(()=>{
        this.listLoading = false
      })
    },
    handleSizeChange(val) {
      this.limit=val
      this.fetchData()
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange(val) {
      this.page=val-1
      this.fetchData()

      console.log(`当前页: ${val}`)
    }
  }
}
</script>
<style lang="scss" scoped>

</style>
